/**
 * FileName: InterceptorConfig
 * Author:   P
 * Date:     2020/9/22 22:47
 * Description:
 */
package com.hospital.nurse.config;

import com.hospital.nurse.interceptor.JWTInterceptor;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.CorsRegistry;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class InterceptorConfig implements WebMvcConfigurer {

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(new JWTInterceptor())
                .addPathPatterns("/patient/*/*")             //拦截
                .addPathPatterns("/care/*/*")             //拦截
                .addPathPatterns("/sickbed/*/*")             //拦截
                .addPathPatterns("/index/*/*")             //拦截
                .excludePathPatterns("/nurses/login");  ///放行
    }
}
